package main

import (
	"github.com/Lofanmi/chinese-calendar-golang/calendar"
    "fmt"
	"time"
    "flag"
)

func main() {
    t := time.Now()
    y := fmt.Sprintf("%4d", t.Year())
    m := fmt.Sprintf("%02d", t.Month())
    d := fmt.Sprintf("%02d", t.Day())
    dayPtr := flag.String("day", y + "-" + m + "-" + d, "the date of the day")
    flag.Parse()

    layout := "2006-01-02"
    nt, err := time.Parse(layout, *dayPtr)
    if err != nil {
        fmt.Println(err)
    }
    
    //c := calendar.BySolar(year, month, day, hour, minute, second)
    c := calendar.BySolar(int64(nt.Year()), int64(nt.Month()), int64(nt.Day()), 0, 0, 0)

    bytes, err := c.ToJSON()

    if err != nil {
        fmt.Println(err)
    }

    fmt.Println(string(bytes))
}
